package Controllers;

import DB.DBSchedule;
import Models.Schedule;
import java.util.ArrayList;

public class ScheduleController implements ControllerInterface<Schedule>
{ 
	public ScheduleController ()
	{}

	public int insert(Schedule schedule)
	{
		DBSchedule dbs = new DBSchedule();
		return dbs.insert(schedule.exportData());
	}

	public void insertDependent(ArrayList<? extends DB.RowInterface> data)
	{}

	public Schedule find(int id)
	{
		DBSchedule dbs = new DBSchedule();
		return dbs.fetchByNo(id);
	}

	public int update(Schedule schedule, String where)
	{
		DBSchedule dbs = new DBSchedule();
		return dbs.update(schedule.exportData(), where);
	}

	public void updateDependent(ArrayList<? extends DB.RowInterface> data, String where)
	{}

	public int delete(int id)
	{
		DBSchedule dbs = new DBSchedule();
		return dbs.deleteByNo(id);
	}

	public ArrayList<Schedule> fetchAll()
	{
		DBSchedule dbs = new DBSchedule();
		return dbs.fetchAll();
	}
}